<!DOCTYPE html>
<meta charset="utf-8" />

<link rel="stylesheet" href="css/page/role.css" />
<style type="text/css">
	.popover{z-index: 2000;}
</style>
<!-- 核心功能组件 -->
<div class="rowt">
<div class="col-xs-12">
<form id="agentForm" class="form-horizontal required-validate"  role="form"  onsubmit="return validateCallback(this,dialogAjaxDone)">
<div class="tabbable" id="agent_form_div"  create-buttom="auto" check-form="true" create-to="formBtnBoxDiv" style="height: 100%">
	<ul class="nav nav-tabs" id="myAgentTab">
		<li class="active">
			<a data-toggle="tab" href="#tabAgentInf"> 
				<i class="green ace-icon fa fa-home bigger-120"></i> 合作商基本信息
			</a>
		</li>
		<li><a data-toggle="tab" href="#tabAgentBankInf">合作商结算账户</a></li>
		<!-- <li><a data-toggle="tab" href="#tabAgentFeeInf"> 合作商费率说明</a></li> -->
		<!-- <li><a data-toggle="tab" href="#tabProfitSectionInf"> 分润区间信息</a></li> -->
		<li><a data-toggle="tab" href="#tabAgentRemarkInf"> 合作商说明信息 </a></li>
		<li><a data-toggle="tab" href="#tabAgentContactInf"> 合作商联系信息 </a></li>
	</ul>
	
 		<input type="hidden" id="type" name="type" />
		<input type="hidden" id="agentIdTemp" name="agentId"/>
		<input type="hidden" id="agentDgr" name="agentDgr"/>
		<input type="hidden" id="fathAgentId" name="fathAgentId"/>
		<input type="hidden" id="firstAgentId" name="firstAgentId"/>
	    <input type="hidden" id="feeCode"   name="feeCode" />
	    <input type="hidden" id="agentCode"   name="agentCode" />
	    <input type="hidden" id="fatherCode"   name="fatherCode" />
	    <input type="hidden" id="createDate"   name="createDate" />
	    <input type="hidden" id="createUserId"   name="createUserId" />
	    <input type="hidden" id="editDate"   name="editDate" />
	    <input type="hidden" id="editUserId"   name="editUserId" />
	    <input type="hidden" id="auditStatus"   name="auditStatus" />
	    
		<div class="tab-content">
			<div id="tabAgentInf" class="tab-pane fade in active">
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right">合作商登录账户： </label>
					<div class="col-sm-3">
						<span class="block input-icon input-icon-right" >
							<input type="text" id="logonName1" name="logonName"
								onkeyup="this.value=this.value.replace(/[^\w]/g,'');"
								placeholder="登录账户" validate="true" class="col-xs-12 col-sm-12"
								value="" maxlength="50"/>
							<i class="ace-icon fa fa-star-o"></i>
						</span>
					</div>
					
					<label class="col-sm-2 control-label no-padding-right">合作商名称： </label>
					<div class="col-sm-3">
						<span class="block input-icon input-icon-right" >
							<input type="text" id="agentName" name="agentName" placeholder="合作商名称" validate="true" class="col-xs-12 col-sm-12" value="" />
							<i class="ace-icon fa fa-star-o"></i>
						</span>
					</div>
				</div>
				
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right">法人姓名： </label>
					<div class="col-sm-3">
						<span class="block input-icon input-icon-right" >
							<input type="text" id="legalName" name="legalName" placeholder="法人姓名" validate="true" class="col-xs-12 col-sm-12" value="" />
							<i class="ace-icon fa fa-star-o"></i>
						</span>
					</div>
					
					<label class="col-sm-2 control-label no-padding-right">税务登记号： </label>
					<div class="col-sm-3">
						<span class="block input-icon input-icon-right" >
							<input type="text" id="taxNo" name="taxNo" placeholder="税务登记号" validate="true" class="col-xs-12 col-sm-12" value="" />
							<i class="ace-icon fa fa-star-o"></i>
						</span>
					</div>
				</div>
				
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right"> 法人身份证号码： </label>
					<div class="col-sm-3">
						<span class="block input-icon input-icon-right" >
							<input type="text" id="legalIdentityNo"  name="legalIdentityNo" placeholder="法人身份证号码" validate="true" class="col-xs-12 col-sm-12" value="" />
							<i class="ace-icon fa fa-star-o"></i>
						</span>
					</div>
					
					<label class="col-sm-2 control-label no-padding-right">法人营业执照号： </label>
					<div class="col-sm-3">
						<span class="block input-icon input-icon-right" >
							<input type="text" id="licNo" name="licNo" placeholder="法人营业执照号" validate="true" class="col-xs-12 col-sm-12" value="" />
							<i class="ace-icon fa fa-star-o"></i>
						</span>
					</div>
				</div>
				
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right">保证金： </label>
					<div class="col-sm-3">
						<span class="block input-icon input-icon-right" >
							<input type="text" id="margin" name="margin" placeholder="保证金" validate="true" class="col-xs-12 col-sm-12" value="" datatype="money" />
							<i class="ace-icon fa fa-star-o"></i>
						</span>
					</div>
					
					<label class="col-sm-2 control-label no-padding-right">邮箱： </label>
					<div class="col-sm-3">
						<span class="block input-icon input-icon-right" >
							<input type="text" id="email" name="email" placeholder="邮箱" validate="true" class="col-xs-12 col-sm-12" value="" datatype="email"/>
							<i class="ace-icon fa fa-star-o"></i>
						</span>
					</div>
				</div>
				
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right">联系电话： </label>
					<div class="col-sm-3">
						<span class="block input-icon input-icon-right" >
							<input type="text" id="tel" name="tel" placeholder="联系电话" validate="true" class="col-xs-12 col-sm-12" value="" />
							<i class="ace-icon fa fa-star-o"></i>
						</span>
					</div>
					
					<label class="col-sm-2 control-label no-padding-right">手机号码： </label>
					<div class="col-sm-3">
						<span class="block input-icon input-icon-right" >
							<input type="text" id="moblieNo" name="moblieNo" placeholder="手机号码" validate="true" class="col-xs-12 col-sm-12" value=""  datatype="mobile" maxlength="11"/>
							<i class="ace-icon fa fa-star-o"></i>
						</span>
					</div>
				</div>
				
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right">
						所属城市： </label>
					<div class="col-sm-4">
						<select  rel="obj.options"
						 location="mpamng/selectoption/getProvince.do" 
						 name="province"
						 valName="value"
						 textName="text"
						 ref="cityId"
						 refUrl="mpamng/selectoption/getCity.do?id={value}"
						 refBox="tabAgentInf"
						 data-placeholder="请选择所在省份" style="width: 125px;vertical-align:middle;">
						</select>
						
						<select 
						 id="cityId"
						 rel="obj.options"
						 name="city"
						 valName="value"
						 textName="text"
						 data-placeholder="请选择所在城市" style="width: 125px;vertical-align:middle;">
						</select>
					</div>
					
					<label class="col-sm-1 control-label no-padding-right">
					 	合作商类型： </label>
					<div class="col-sm-3">
						<div class="input-group  col-xs-12 col-sm-12">
							<select 
									rel="obj.AGENT_TYPE"
									location="local" 
									 name="agentType" 
									 id="agentType" 
									 defVal="03"
									 style="width: 120px;vertical-align:middle;">
							 </select>
							 <span class="help-button" data-rel="popover" data-trigger="hover" data-placement="left" 
								title="如何选择合作商类型?"
								data-content="01.常规合作商:常规合作商主要是开展用户推荐到平台注册享受交易分润,可发展下一级合作商,适用于个人或商铺入驻;02:渠道代理商:主要协助平台方拓展支付渠道需求商户,享受交易分润,适用于拓展有系统的商户通过API接口对接来完成支付交易,可拓展下一级合作商;03:渠道大商户:渠道大商户即为有系统的商家,通过API接口对接来完成支付交易,不可拓展下级合作商." 
								>?</span>
						</div>
					</div>
					
				</div>
				
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right"> 联系地址： </label>
					<div class="col-sm-8">
						<span class="block input-icon input-icon-right" >
							<input type="text" id="address" name="address" placeholder="联系地址" validate="true" class="col-xs-12 col-sm-12" value="" />
							<i class="ace-icon fa fa-star-o"></i>
						</span>
					</div>
				</div>
				
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right">
					 	合同开始日期： </label>
					<div class="col-sm-3">
						<div class="input-group  col-xs-12 col-sm-12">
							<input class="form-control date-picker" id="contractStrDate" name="contractStrDate"  type="text" placeholder="合同开始日期" validate="true" data-date-format="yyyymmdd" readonly="readonly"/>
							<span class="input-group-addon">
								<i class="fa fa-calendar bigger-110"></i>
							</span>
						</div>
					</div>
					
					<label class="col-sm-2 control-label no-padding-right">
					 	合同结束日期： </label>
					<div class="col-sm-3">
						<div class="input-group  col-xs-12 col-sm-12">
							<input class="form-control date-picker" id="contractEndDate" name="contractEndDate"  type="text" placeholder="合同结束日期" validate="true" data-date-format="yyyymmdd" readonly="readonly"/>
							<span class="input-group-addon">
								<i class="fa fa-calendar bigger-110"></i>
							</span>
						</div>
					</div>
				</div>
				
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right">
						启用T+0提现： </label>
					<div class="col-sm-3">
						<label>
							<input name="tiflg" id="tiflg" class="ace ace-switch ace-switch-4 btn-empty" type="checkbox" value="0"/>
							<span class="lbl" data-lbl="否&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;是"></span>
						</label>
					</div>
					
					<label class="col-sm-2 control-label no-padding-right">
						结算类型： </label>
					<div class="col-sm-3">
						<label>
							<input name="slttyp" id="slttyp" class="ace ace-switch ace-switch-4 btn-empty" type="checkbox" value="0"/>
							<span class="lbl" data-lbl="日结  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;月结"></span>
						</label>
					</div>
				</div>	
				
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right"> OEM标识： </label>
					<div class="col-sm-3">
						<label>
							<input name="oemState" id="oemState" class="ace ace-switch ace-switch-4 btn-empty" type="checkbox" value="0"/>
							<span class="lbl" data-lbl="否&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;是" ></span>
						</label>
					</div>
					<label class="col-sm-2 control-label no-padding-right">
						是否冻结： </label>
					<div class="col-sm-3">
						<label>
							<input name="frozState" id="frozState" class="ace ace-switch ace-switch-4 btn-empty" type="checkbox" value="0" />
							<span class="lbl" data-lbl="否 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;是"></span>
						</label>
					</div>
				</div>	
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right">
						合作商禁用： </label>
					<div class="col-sm-3">
						<label>
							<input name="agentStatus" id="agentStatus" class="ace ace-switch ace-switch-4 btn-empty" type="checkbox" value="0"/>
							<span class="lbl" data-lbl="否&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;是"></span>
						</label>
					</div>
					
					<label class="col-sm-2 control-label no-padding-right">
						&nbsp; </label>
					<div class="col-sm-3">
						<label>
							&nbsp;
						</label>
					</div>
				</div>	
			</div>
			<div id="tabAgentBankInf" class="tab-pane fade">
				<div class="form-group">
					<label class="col-sm-3 control-label no-padding-right">持卡人名称： </label>
					<div class="col-sm-3">
						<span class="block input-icon input-icon-right" >
							<input type="text" name="bankpayusernm" placeholder="持卡人名称" validate="true" class="col-xs-12 col-sm-12" value="" />
							<i class="ace-icon fa fa-star-o"></i>
						</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-3 control-label no-padding-right">银行账号： </label>
					<div class="col-sm-5">
						<span class="block input-icon input-icon-right" >
							<input type="text" name="bankpayacno" placeholder="银行账号" validate="true" class="col-xs-12 col-sm-12" value="" />
							<i class="ace-icon fa fa-star-o"></i>
						</span>
					</div>
				</div>
				 
<!-- 				<div class="form-group"> -->
<!-- 					<label class="col-sm-3 control-label no-padding-right"> -->
<!-- 						开户行： </label> -->

<!-- 					<div class="col-sm-9"> -->
<!-- 							 <select  -->
<!-- 								 rel="rows" -->
<!-- 					 			 location="auth/sysManage/query.do"  -->
<!-- 					 			 data="{pageSize:'100'}" -->
<!-- 								 name="bankcode"  -->
<!-- 								 valName="id" -->
<!-- 								 textName="name" -->
<!-- 					 			 data-placeholder="请选择所属系统" style="width: 160px;vertical-align:middle;"> -->
<!-- 							</select> -->
							
<!-- 					</div> -->
<!-- 				</div> -->
				<div class="form-group">
					<label class="col-sm-3 control-label no-padding-right">
						开户许可证： </label>
					<div class="col-sm-9">
						<input class="col-xs-10 col-sm-7" type="hidden" id="openingLicensePicId" name="openingLicensePicId" />
						<input class="col-xs-10 col-sm-5" type="text" id="openingLicensePicName" name="openingLicensePicName" readonly="readonly"/>
						<span class="">
							<button class="btn btn-small btn-yellow" type="button" onclick="upload02('openingLicensePicId','openingLicensePicName')">
								选择文件
							</button>
							<button class="btn btn-small btn-info" type="button" onclick="agentPicView('openingLicensePicId');">
								预览
							</button>
						</span>
					</div>
				</div>
			</div>
			
			<div id="tabAgentFeeInf" class="tab-pane fade">
				<input type="hidden" name="rateTypeJson" value="" />
			</div>
			<!-- <div id="tabProfitSectionInf" class="tab-pane fade">
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right">
						一档（元）： </label>
					<div class="col-sm-2">
						<input type="text" id="grade_1_start" name="grade_1_start" placeholder="一档起始金额" 
							class="col-xs-12 col-sm-12 feecheck" value="0" readonly="readonly" judge="grade"/>
					</div>
					<div class="col-sm-1">
						<span class="input-group-addon">
							<i class="fa fa-long-arrow-right"></i>
						</span>
					</div>
					<div class="col-sm-2">
						<input type="text" id="grade_1_end" name="grade_1_end" placeholder="一档结束金额" 
							class="col-xs-12 col-sm-12 feecheck" value="" judge="grade" onkeyup="setGradeValue(this);"/>
					</div>
					<label class="col-sm-1 control-label no-padding-right">
						分润比例： </label>
					<div class="col-sm-2">
						<input class="col-xs-12 col-sm-12 feecheck" type="text" id="profitRatio_1" name="profitRatio_1" placeholder="一档分润比例(十分之几)" validate="true" datatype="number" judge="agentRate"/>
					</div>
				</div>
				
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right">
						二档（元）： </label>
					<div class="col-sm-2">
						<input type="text" id="grade_2_start" name="grade_2_start" placeholder="二档起始金额" 
							class="col-xs-12 col-sm-12 feecheck" value="" judge="grade" readonly="readonly"/>
					</div>
					<div class="col-sm-1">
						<span class="input-group-addon">
							<i class="fa fa-long-arrow-right"></i>
						</span>
					</div>
					<div class="col-sm-2">
						<input type="text" id="grade_2_end" name="grade_2_end" placeholder="二档结束金额" 
							class="col-xs-12 col-sm-12 feecheck" value="" judge="grade" onkeyup="setGradeValue(this);"/>
					</div>
					<label class="col-sm-1 control-label no-padding-right">
						分润比例： </label>
					<div class="col-sm-2">
						<input class="col-xs-12 col-sm-12 feecheck" type="text" id="profitRatio_2" name="profitRatio_2" placeholder="二档分润比例(十分之几)" validate="true" datatype="number" judge="agentRate"/>
					</div>
				</div>
				
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right">
						三档（元）： </label>
					<div class="col-sm-2">
						<input type="text" id="grade_3_start" name="grade_3_start" placeholder="三档起始金额" 
							class="col-xs-12 col-sm-12 feecheck" value="" judge="grade" readonly="readonly"/>
					</div>
					<div class="col-sm-1">
						<span class="input-group-addon">
							<i class="fa fa-long-arrow-right"></i>
						</span>
					</div>
					<div class="col-sm-2">
						<input type="text" id="grade_3_end" name="grade_3_end" placeholder="三档结束金额" 
							class="col-xs-12 col-sm-12 feecheck" value="" judge="grade" onkeyup="setGradeValue(this);"/>
					</div>
					<label class="col-sm-1 control-label no-padding-right">
						分润比例： </label>
					<div class="col-sm-2">
						<input class="col-xs-12 col-sm-12 feecheck" type="text" id="profitRatio_3" name="profitRatio_3" placeholder="三档分润比例(十分之几)" validate="true" datatype="number" judge="agentRate"/>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right">
						四档（元）： </label>
					<div class="col-sm-2">
						<input type="text" id="grade_4_start" name="grade_4_start" placeholder="四档起始金额" 
							class="col-xs-12 col-sm-12 feecheck" value="" judge="grade" readonly="readonly"/>
					</div>
					<div class="col-sm-1">
						<span class="input-group-addon">
							<i class="fa fa-long-arrow-right"></i>
						</span>
					</div>
					<div class="col-sm-2">
						<input type="text" id="grade_4_end" name="grade_4_end" placeholder="四档结束金额" 
							class="col-xs-12 col-sm-12 feecheck" value="∞" readonly="readonly" judge="grade"/>
					</div>
					<label class="col-sm-1 control-label no-padding-right">
						分润比例： </label>
					<div class="col-sm-2">
						<input class="col-xs-12 col-sm-12 feecheck" type="text" id="profitRatio_4" name="profitRatio_4" placeholder="四档分润比例(十分之几)" validate="true" datatype="number" judge="agentRate"/>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right">
						分润比例： </label>
					<div class="col-sm-3">
						<input class="col-xs-12 col-sm-12 feecheck" type="text" id="profitRatio" name="profitRatio" placeholder="分润比例(十分之几)" validate="true" datatype="number" judge="agentRate"/>
					</div>
				</div>
			</div> -->
            <div id="tabAgentRemarkInf" class="tab-pane fade">
            	<div class="form-group" style="display:none;" id="oemDiv">
					<label class="col-sm-3 control-label no-padding-right">
						合作商LOGO： </label>
					<div class="col-sm-9">
						<input class="col-xs-10 col-sm-7" type="hidden" id="oemPicId" name="oemPicId" />
						<input class="col-xs-10 col-sm-5" type="text" id="oemPicName" name="oemPicName" readonly="readonly"/>
						<span class="">
							<button class="btn btn-small btn-yellow" type="button" onclick="upload02('oemPicId','oemPicName')">
								选择文件
							</button>
							<button class="btn btn-small btn-info" type="button" onclick="agentPicView('oemPicId');">
								预览
							</button>
						</span>
					</div>
				</div>
            	
				<div class="form-group">
					<label class="col-sm-3 control-label no-padding-right">
						营业执照： </label>
					<div class="col-sm-9">
						<input class="col-xs-10 col-sm-7" type="hidden" id="businessLicensePicId" name="businessLicensePicId" />
						<input class="col-xs-10 col-sm-5" type="text" id="businessLicensePicName" name="businessLicensePicName" readonly="readonly"/>
						<span class="">
							<button class="btn btn-small btn-yellow" type="button" onclick="upload02('businessLicensePicId','businessLicensePicName')">
								选择文件
							</button>
							<button class="btn btn-small btn-info" type="button" onclick="agentPicView('businessLicensePicId');">
								预览
							</button>
						</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-3 control-label no-padding-right">
						法人身份证： </label>
					<div class="col-sm-9">
						<input class="col-xs-10 col-sm-7" type="hidden" id="legalIdentityPicId" name="legalIdentityPicId" />
						<input class="col-xs-10 col-sm-5" type="text" id="legalIdentityPicName" name="legalIdentityPicName" readonly="readonly"/>
						<span class="">
							<button class="btn btn-small btn-yellow" type="button" onclick="upload02('legalIdentityPicId','legalIdentityPicName')">
								选择文件
							</button>
							<button class="btn btn-small btn-info" type="button" onclick="agentPicView('legalIdentityPicId');">
								预览
							</button>
						</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-3 control-label no-padding-right">
						税务登记证： </label>
					<div class="col-sm-9">
						<input class="col-xs-10 col-sm-7" type="hidden" id="taxNoPicId" name="taxNoPicId" />
						<input class="col-xs-10 col-sm-5" type="text" id="taxNoPicName" name="taxNoPicName" readonly="readonly"/>
						<span class="">
							<button class="btn btn-small btn-yellow" type="button" onclick="upload02('taxNoPicId','taxNoPicName')">
								选择文件
							</button>
							<button class="btn btn-small btn-info" type="button" onclick="agentPicView('taxNoPicId');">
								预览
							</button>
						</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-3 control-label no-padding-right">
						合作商说明信息： </label>
					<div class="col-sm-9">
						<textarea id="remark" name="remark" class="col-xs-10 col-sm-7" class="form-control limited"  maxlength="200"></textarea>
					</div>
				</div>
			</div>
            <div id="tabAgentContactInf" class="tab-pane fade">
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right">
						技术联系人： </label>
					<div class="col-sm-3">
						<input type="text" name="techcontact" placeholder="技术联系人" validate="true"
							class="col-xs-12 col-sm-12" value="" />
					</div>
					<label class="col-sm-2 control-label no-padding-right">
						技术联系邮箱： </label>
					<div class="col-sm-3">
						<input type="text" name="techemail" placeholder="技术联系邮箱" validate="true"
							class="col-xs-12 col-sm-12" value="" />
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right">
						技术联系手机： </label>
					<div class="col-sm-3">
						<input type="text" name="techmobno" placeholder="技术联系手机" validate="true"
							class="col-xs-12 col-sm-12" value="" />
					</div>
					<label class="col-sm-2 control-label no-padding-right">
						技术联系电话： </label>
					<div class="col-sm-3">
						<input type="text" name="techtelno" placeholder="技术联系电话" validate="true"
							class="col-xs-12 col-sm-12" value="" />
					</div>
				</div>
				
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right">
						业务联系人： </label>
					<div class="col-sm-3">
						<input type="text" name="bizcontact" placeholder="业务联系人" validate="true"
							class="col-xs-12 col-sm-12" value="" />
					</div>
					<label class="col-sm-2 control-label no-padding-right">
						业务联系手机： </label>
					<div class="col-sm-3">
						<input type="text" name="bizmobno" placeholder="业务联系手机" validate="true"
							class="col-xs-12 col-sm-12" value="" />
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right">
						客服联系人： </label>
					<div class="col-sm-3">
						<input type="text" name="servcontact" placeholder="客服联系人" validate="true"
							class="col-xs-12 col-sm-12" value="" />
					</div>
					<label class="col-sm-2 control-label no-padding-right">
						客服联系手机： </label>
					<div class="col-sm-3">
						<input type="text" name="servmobno" placeholder="客服联系手机" validate="true"
							class="col-xs-12 col-sm-12" value="" />
					</div>
				</div>
				<div class="form-group" id="auditFailReasonDiv" style="display:none;">
					<label class="col-sm-2 control-label no-padding-right">
						审批不通过意见： </label>
					<div class="col-sm-8">
						<input type="text" id="auditFailReason" name="auditFailReason" placeholder="审批不通过意见" 
							class="col-xs-12 col-sm-12" value="" />
					</div>
				</div>
				<div class="role-btn-box">
				</div>
			</div>
		</div>
</div>
</form>
</div>
</div>
<div class="align-right" style="margin-top: 10px;" id="formBtnBoxDiv">
	<button class="btn btn-info no-hidden"  onclick="agentAuditSubmit('1')" id="agreeBtn">通过</button>
	<button class="btn btn-info no-hidden"   onclick="agentAuditSubmit('0')" id="disAgreeBtn">拒绝</button>
	<button class="btn btn-submit no-hidden" onclick="agentInfSubmit()" id="saveBtn">保存</button>
</div>
<script type="text/javascript">

$('[data-rel=tooltip]').tooltip({container:'body'});
$('[data-rel=popover]').popover({container:'body'});

$(document).ready(function() {
	$("#span_tabAgentBankInf").click(function(event) {
		if(tabSwitch('tabAgentInf','tabAgentBankInf')==false){
			return false;
		}
	});
	
	$('.date-picker').datepicker({
		autoclose: true,
		todayHighlight: true
	})
	.next().on(ace.click_event, function(){
		$(this).prev().focus();
	});
	
	$("#oemState").change(function() {
		if($(this).val()=='on'||$(this).val()==1){
			$("#oemDiv").hide();
		}
		if($(this).val()==0){
			$("#oemDiv").show();
		}
	});

	setTimeout(setType, 100);
	
	var time = setInterval(function(){
		if($("#agentIdTemp").val()!=''){
			clearInterval(time);
			initProfitData();
		}
	},100);
});

function initProfitData(){
	var agentId = $("#agentIdTemp").val();
	 $.ajax({
			type : "post",
			url : "mpamng/agent/queryGrade.do",
			dataType : 'json',
			data:{agentId:agentId},
			success : function(result) {
				$.each(result.rows,function(index,obj){
					 var index = index + 1;
					 $('#grade_'+index+'_start').val(obj.beginNum);
					 if(index != 4){
					     $('#grade_'+index+'_end').val(obj.endNum);
					 }
					 $('#profitRatio_'+index).val(obj.rates); 
				});
			},
			error : function(XMLHttpRequest, textStatus) {
			}
		});	 
}

function setType(){
	var oem=$("#oemState").val();
	if(oem=='on'||oem==1){
		$("#oemDiv").show();
	}
	if(oem==0){
		$("#oemDiv").hide();
	}
	var dialog=$("#dlg-agentEdit").Dialog();
	if (dialog==null||undefined==dialog){
		$("div[name='nextDiv']").show();
		$("#agreeBtn").remove();
		$("#disAgreeBtn").remove();
		$("#agentForm").attr("action","mpamng/agent/addAgent.do");
	}else if(dialog.pageParam.type=='view'){
		/*********查询，加载实际费率************/
		initRateValue();
		/*************************************/
		$("#formBtnBoxDiv").show();
		$("#saveBtn").remove();
		$("#agreeBtn").remove();
		$("#disAgreeBtn").remove();
		$("#agentForm .btn-yellow").remove();
		$("#agentForm input[type=text]").attr("readonly","readonly");
		$("#agentForm input[type=checkbox]").attr("disabled","disabled");
		$("#agentForm select").attr("disabled", "disabled");
		$("#remark").attr("readonly","readonly");
		$("#agentForm input[type=text]").attr("placeholder","");
	} else if(dialog.pageParam.type=='edit') {
		/*********修改，加载实际费率************/
		initRateValue();
		/**********************************************/
		$("#formBtnBoxDiv").show();
		$("#agreeBtn").remove();
		$("#disAgreeBtn").remove();
		$("#agentForm").attr("action","mpamng/agent/eidtAgent.do");
		$("#logonName1").attr("readonly","readonly");
	} else if(dialog.pageParam.type=='audit') {
		/*********审核，加载提交的审核费率************/
		initTempRateValue();
		/****************************************/
		$("#formBtnBoxDiv").show();
		if($("#auditStatus").val()==2) {//审核拒绝，禁止再审核，可以修改后重新提交
			$("#agreeBtn").remove();
			$("#disAgreeBtn").remove();
			$("#agentForm").attr("action","mpamng/agent/eidtAgent.do");
			$("#logonName1").attr("readonly","readonly");
			$("#auditFailReasonDiv").show();
			$("#auditFailReason").attr("readonly","readonly");
		} else if($("#auditStatus").val()==1){//审核通过，禁止再操作
			$("#saveBtn").remove();
			$("#agreeBtn").remove();
			$("#disAgreeBtn").remove();
			$("#agentForm .btn-yellow").remove();
			$("#agentForm input[type=text]").attr("readonly","readonly");
			$("#agentForm input[type=checkbox]").attr("disabled","disabled");
			$("#agentForm select").attr("disabled", "disabled");
			$("#remark").attr("readonly","readonly");
		} else {
			$("#saveBtn").remove();
			$("#agentForm").attr("action","mpamng/agent/agentTempReply.do");
			$("#agentForm .btn-yellow").remove();
			$("#agentForm input[type=text]").attr("readonly","readonly");
			$("#agentForm input[type=checkbox]").attr("disabled","disabled");
			$("#agentForm select").attr("disabled", "disabled");
			$("#remark").attr("readonly","readonly");
			$("#auditFailReasonDiv").show();
			$("#auditFailReason").attr("readonly",false);
		}
		
		//2017-03-21 18:40 选择指定控件可用 fr
		$("#agentForm input[name=rateType]").removeAttr("readonly");
	}
	
	// 异步加载合作商费率参数
	msg_Title="当前合作商";
	$.ajax({
		type : "post",
		url : "mpamng/agent/outOfRate.do",
		dataType : 'json',
		success : function(result) {
			if (result.rspcod != 200) {
				msg.alert("错误", result.rspmsg + " 错误代码："+ result.rspcod, 'error');
			} else {
				agentInf=result.obj;
			}
		},
		error : function(XMLHttpRequest, textStatus) {
			msg.alert("错误", "错误代码：" + XMLHttpRequest.status + ",错误描述："+ textStatus, 'error');
		}
	});
}

/**上一步下一步切换*/
function tabSwitch(current,next){
	//如果表单验证不通过，不能进入下一步
	var v = TDValidateForm($("#"+current));
	if(v === false){
		return false;
	}
	$('a[href*="'+next+'"]').trigger('click');
}
//合作商开户保存
function agentInfSubmit(){
	$("#frozState").val($("#frozState").val());
	$("#oemState").val($("#oemState").val());
	$("#tiflg").val($("#tiflg").val());
	$("#slttyp").val($("#slttyp").val());   
	$("#agentStatus").val($("#agentStatus").val());
	var $form = $('#agentForm');
	var bool = TDValidateForm($form);
	if(!bool){
		return false;
	}
	getRateTypeJson();
	$form.submit();
} 

function dialogAjaxDone(result){
	if(result.rspcod== 200){
		msg.alert("提示",result.rspmsg,'correct');
		if($("#type").val()=='edit'||$("#type").val()=='audit'){
			$("#grid-table").trigger("reloadGrid");
			dialog.closeById('dlg-agentEdit');
		} else {
			//location.href=$.getBaseHerf()+"auth/mainPanel.do#mpamng/agent/agentListView.do";
		}
	}else{
		msg.alert("错误",result.rspmsg,'error');
	}
}

function upload02(fid,fname){
	openFileUpload({
		fileUploadDone:function(reslut){
			$("#"+fid).val(reslut.map.fid);
			$("#"+fname).val(reslut.map.fname);
		}
	});
}

/** 审核提交 **/
function agentAuditSubmit(approved){
	getRateTypeJson();
	var rateTypeJson = $("[name=rateTypeJson]").val();
	var agentId=$("#agentIdTemp").val();
	var editUserId=$("#editUserId").val();
	var auditFailReason=$("#auditFailReason").val();
	
	$.ajax({
		type : "post",
		url : "mpamng/agent/agentTempReply.do",
		data:{agentId:agentId,approved:approved,editUserId:editUserId,auditFailReason:auditFailReason,rateTypeJson:rateTypeJson},
		dataType : 'json',
		success : function(result) {
			if(result.rspcod== 200){
				msg.alert("提示",result.rspmsg,'correct');
				$("#grid-table").trigger("reloadGrid");
				dialog.closeById('dlg-agentEdit');
			}else{
				msg.alert("错误",result.rspmsg,'error');
			}
		},
		error : function(XMLHttpRequest, textStatus) {
			msg.alert("错误", "错误代码：" + XMLHttpRequest.status + ",错误描述："+ textStatus, 'error');
		}
	});
	
}
/**
 * 图片预览
 */
function agentPicView(id){
	if($('#'+id).val()==''){
		alertMsg.alert("错误","图片不存在，请先上传图片!","error");
		return false;
	}
	picview($('#'+id).val());
}

function setGradeValue(obj){
	if(isNaN($(obj).val()) || $.trim($(obj).val()) == ''){
		$(obj).val('');
	}
	var id = parseInt($(obj).attr("id").split('_')[1]) + 1;
	$('#grade_' + id +'_start').val($(obj).val())
}

//2017-03-21 加载所有交易类型费率的方法 fr
function initAgentRate(){
	var rateTypeMap =DICT.get("RATETYPE");
	var num = 1;
	var con = true;
	var div = "";
	var dialog=$("#dlg-agentEdit").Dialog();
	$.each(rateTypeMap,function(key,value){
		if(key == '0'){
			return;
		}
		if(num%2==1){
			div=div+"<div class='form-group'>"+
						"<label class='col-sm-2 control-label no-padding-right'>"+
							value+"： </label>"+
						"<div class='col-sm-3'>"+
							"<input lang='"+key+"' type='text' id='rate_type_"+key+"' class='rateType'  name='rateType' placeholder='请设置"+value+"费率'"+ 
								"class='col-xs-12 col-sm-12 feecheck' value='' judge='agentRate'/>"+
						"</div>";
			con = true;
		}
		
		if(num%2==0){
			div=div+	"<label class='col-sm-2 control-label no-padding-right'>"+
							value+"： </label>"+
						"<div class='col-sm-3'>"+
							"<input lang='"+key+"' type='text' id='rate_type_"+key+"' class='rateType' name='rateType' placeholder='请设置"+value+"费率'"+ 
								"class='col-xs-12 col-sm-12 feecheck' value='' judge='rateType'/>"+
						"</div>"+
					"</div>";
			con = false;
			$("#tabAgentFeeInf").append(div);
			div="";
		}
		num+=1;
	});
	//如果数据量为单数，则补齐div结尾签，保证样式对称 fr
	if(con){
		div=div+	"<label class='col-sm-2 control-label no-padding-right'>"+
						"</label>"+
					"<div class='col-sm-3'>"+
					"</div>"+
				"</div>";
		con = false;
		$("#tabAgentFeeInf").append(div);
	}
}
//执行加载费率类型 fr
//initAgentRate();

//2017-03-21 获取用户设置的费率类型json字符串存放到表单中 fr
function getRateTypeJson(){
	var rateTypeJson = "[";
	var num = 0;
 	$(".rateType").each(function(){
 		if($(this).val().length!=0){
 			if(num>0){
 	 			rateTypeJson+=",";
 	 		}
 	 		rateTypeJson+='{"rateType":"'+$(this).attr("lang")+'","rateValue":"'+$(this).val()+'"}';
 	 		num+=1;
 		}
	  });
 	rateTypeJson+="]";
	//存放到表单的隐藏元素中
	if(num>0){
		$("[name=rateTypeJson]").val(rateTypeJson);
	}
};

//加载审核商户临时表的费率信息
function initTempRateValue(){
	var respData = $("#dlg-agentEdit").Dialog().respData.obj.dataString;
	var jsonObj = JSON.parse(respData);
	if (jsonObj==null) {
		return;
	}
	if(jsonObj.rateType==null){
		return;
	}
	var rateList = jsonObj.rateType;
	for(var i =0;i<rateList.length;i++){
		$("#rate_type_"+rateList[i].rateType).val(rateList[i].rateValue);
	}
};

//加载商户的实际费率信息
function initRateValue(){
	//2017-03-21 17:26 根据商户加载费率信息 fr
	var agentId = $("#dlg-agentEdit").Dialog().dataParam.agentId;
		$.ajax({
			async: false,
			type : "post",
			url : "mpamng/agent/queryAgentRate.do",
			data:{"agentId":agentId},
			dataType : 'json',
			success : function(result) {
				var rateList = result.obj;
				for(var i =0;i<rateList.length;i++){
					$("#rate_type_"+rateList[i].rateType).val(rateList[i].rateT0);
				}
			},
			error : function(XMLHttpRequest, textStatus) {
				msg.alert("错误", "错误代码：" + XMLHttpRequest.status + ",错误描述："+ textStatus, 'error');
			}
		});
};
</script>
